﻿using UnityEngine;
using UnityEngine.UIElements;

namespace winS.UnityEditor.UIElement
{
    /// <summary>
    /// 垂直滚动条
    /// </summary>
    public class VerticalScrollBar : VisualElement
    {
        /// <summary>
        /// 默认滚动条颜色
        /// </summary>
        public static readonly Color defaultScrollBarColor = new Color32(192, 192, 192, 255);

        /// <summary>
        /// 位置(Y轴)
        /// </summary>
        public float position { get => style.top.value.value; set => style.top = value; }

        internal VerticalScrollBar()
        {
            style.right = 0f;
            style.minWidth = 1f;
            style.position = Position.Absolute;
            style.SetBackgroundColor(defaultScrollBarColor);
        }

        public void SetHeight(float height)
        {
            style.height = height;
        }
    }
}
